/**
 * Copyright &copy; 2012-2014 <a href="https://github.cn.apestar">JeeSite</a> All rights reserved.
 */
package cn.apestar.modules.common.feedback.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.apestar.common.persistence.Page;
import cn.apestar.common.service.CrudService;
import cn.apestar.modules.common.feedback.dao.FeedbackDao;
import cn.apestar.modules.common.feedback.entity.Feedback;

/**
 * 反馈建议Service
 * @author LVH
 * @version 2016-07-12
 */
@Service
@Transactional(readOnly = true)
public class FeedbackService extends CrudService<FeedbackDao, Feedback> {

    @Override
    public Feedback get(String id) {
        return super.get(id);
    }

    @Override
    public List<Feedback> findList(Feedback feedback) {
        return super.findList(feedback);
    }

    @Override
    public Page<Feedback> findPage(Page<Feedback> page, Feedback feedback) {

        for (Feedback fb : page.getList()) {
            fb.setType("complain");
        }

        feedback.setType("complain");

        return super.findPage(page, feedback);
    }

    public Page<Feedback> findCustomerPage(Page<Feedback> page, Feedback feedback) {

        for (Feedback fb : page.getList()) {
            fb.setType("consumer");
        }

        feedback.setType("consumer");

        return super.findPage(page, feedback);
    }

    @Override
    @Transactional(readOnly = false)
    public void save(Feedback feedback) {
        super.save(feedback);
    }

    @Override
    @Transactional(readOnly = false)
    public void delete(Feedback feedback) {
        super.delete(feedback);
    }

}